<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        //1.字面量方式创建对象
        var obj={};
        console.log(obj);

        var student={
            name:'zhangsan',
            age: 23,
            study:function () {
                console.log(this.name+'在学习');
            }
        }
        student.study();
        student.gender='男';

        //2.构造函数方式创建对象
        function Animal() {
            this.id='1';
            this.name='lisi';
            this.age=22;
            this.run=function () {
                console.log(this.name+'正在跑');
            }
        }
        var cat=new Animal();
        cat.run();
    </script>
</body>
</html>